#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Framework/EditorViewSubsystem.h"
#include "Misc/EngineEditorMacros.h"
#include "EditorWindowView.h"
#include "EditorWindowViewModel.h"
#include "Math/IntPoint.h"
#include "EditorWindowGroupView.m.h"

class REditorToolTipWindowView;
class REditorContextMenuView;
class REditorPopupMenuView;
class RWidget;

//view of a window group
//also the root object of all view
RCLASS()
class ENGINEEDITOR_API REditorWindowGroupView : public REditorViewSubsystem
{
    ROBJECT

public:
    virtual void Initialize() override;
    virtual void Deinitialize() override;

    static REditorWindowGroupView* Get();

    void RegisterWindow(TSharedObjectPtr<REditorWindowView> WindowView);
    void UnregisterWindow(TSharedObjectPtr<REditorWindowView> WindowView);
    void CloseWindow(TSharedObjectPtr<REditorWindowView> WindowView);

    TSharedObjectPtr<RWidget> CreatePopupMenu(
        const SIntPoint & InMenuSize
        ,TSharedObjectPtr<RWidget> InWidgetToAround
    );

    void ClosePopupMenu();

protected:
    TSharedObjectPtr<REditorWindowView> CreateWindowView(
        TSharedObjectPtr<REditorWindowViewModel> WindowViewModel 
    );

    TVector<TSharedObjectPtr<REditorWindowView>> Windows;


    TSharedObjectPtr<REditorToolTipWindowView> Tooltip;

    TSharedObjectPtr<REditorContextMenuView> ContextMenu;

    TSharedObjectPtr<REditorPopupMenuView> PopupMenu;
};